﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlUser.ascx.cs" Inherits="UserControl_ControlUser" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="uscMsgBox.ascx" TagName="uscMsgBox" TagPrefix="uc1" %>
<script type="text/javascript">
    function pageLoad() {
        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnSave.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnDelete.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnFind.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= btnSearch.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }

</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="direct_container_right_titletop">
            Quản lý thông tin người dùng
        </div>
        <hr />
        <!-- Button chuc nang-->
        <div class="direct_container_main">
            <asp:ImageButton ID="imgBtnAdd" CausesValidation="false" ImageUrl="~/Images/add.png"
                Width="32px" Height="32px" runat="server" OnClick="imgBtnAdd_Click" /></a>
            <asp:ImageButton ID="imgBtnSave" ImageUrl="~/Images/save.png" Width="32px" Height="32px"
                runat="server" OnClick="imgBtnSave_Click" />
            <asp:ImageButton ID="imgBtnDelete" ImageUrl="~/Images/delete.png" Width="32px" Height="32px"
                runat="server" />
            <asp:ImageButton ID="imgBtnFind" CausesValidation="false" ImageUrl="~/Images/find.png"
                Width="32px" Height="32px" runat="server" OnClick="imgBtnFind_Click" />
        </div>
        <!-- End Button chuc nang-->
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" BackColor="#CCFFFF"
            Font-Names="Arial" Height="500px" Width="100%">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập thông tin" TabIndex="0">
                <ContentTemplate>
                    <!-- Content main-->
                    <div class="direct_container_main">
                        <div class="direct_container_form_right">
                            <table border="0" width="100%">
                                <tr>
                                    <td align="right" width="15%">
                                        <p class="direct_label">
                                            Chi nhánh</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlChiNhanh" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Tên đăng nhập</p>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtUserName" CssClass="input_full" runat="server"></asp:TextBox>
                                         <asp:RequiredFieldValidator ControlToValidate="txtUserName" Display="None"  ID="RequiredFieldValidator2" runat="server" ErrorMessage="Phải nhập tên đăng nhập">
                                         </asp:RequiredFieldValidator>
                                         <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator2" ID="ValidatorCalloutExtender4" runat="server">
                                        </cc1:ValidatorCalloutExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Tên Người Dùng</p>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtName" CssClass="input_full" runat="server"></asp:TextBox>
                                         <asp:RequiredFieldValidator ControlToValidate="txtName" Display="None"  ID="RequiredFieldValidator1" runat="server" ErrorMessage="Phải nhập họ tên người dùng">
                                         </asp:RequiredFieldValidator>
                                         <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator1" ID="ValidatorCalloutExtender1" runat="server">
                                        </cc1:ValidatorCalloutExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Mật khẩu</p>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtPass" TextMode="Password" CssClass="input_full" runat="server"></asp:TextBox>
                                         <asp:RequiredFieldValidator ControlToValidate="txtPass" Display="None"  ID="RequiredFieldValidator3" runat="server" ErrorMessage="Phải nhập mật khẩu của bạn">
                                         </asp:RequiredFieldValidator>
                                         <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator3" ID="ValidatorCalloutExtender2" runat="server">
                                         </cc1:ValidatorCalloutExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Xác nhận</p>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtConfirmPass" TextMode="Password" CssClass="input_full" runat="server"></asp:TextBox>
                                         <asp:CompareValidator ID="CompareValidator1" Display="None" runat="server"  ControlToCompare="txtPass" ControlToValidate="txtConfirmPass" ErrorMessage="Nhập lại không chính xác" ValidationGroup="CheckText"></asp:CompareValidator>
                                        <cc1:ValidatorCalloutExtender TargetControlID="CompareValidator1" ID="ValidatorCalloutExtender3" runat="server">
                                        </cc1:ValidatorCalloutExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Thuộc nhóm</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlThuocNhom" CssClass="input_full" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Được phép đăng nhập</p>
                                    </td>
                                    <td align="left">
                                        <asp:CheckBox ID="chbCanLogin" CssClass="input_full" runat="server"></asp:CheckBox>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <!-- EndContent main-->
                </ContentTemplate>
            </cc1:TabPanel>
            <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="Tìm kiếm" TabIndex="1">
                <ContentTemplate>
                    <div class="direct_container_form_right">
                        <table border="0" width="100%">
                            <tr>
                                <td>
                                    <p class="direct_legend">
                                        Nhập thông tin cần tìm</p>
                                </td>
                            </tr>
                            <tr>
                                <td valign="middle">
                                    <asp:TextBox ID="txtSearch" CssClass="input_full" runat="server"></asp:TextBox>
                                    <asp:Button ID="btnSearch" CssClass="direct_bt_search" runat="server" CausesValidation="False"
                                        Text="Tìm kiếm" OnClick="btnSearch_Click" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                   <asp:GridView ID="grvUser" runat="server" AutoGenerateColumns="False" 
                                                        DataKeyNames="UserName" EnableModelValidation="True" 
                                                        OnPageIndexChanging="grvUser_PageIndexChanging" 
                                                        onrowcommand="grvUser_RowCommand">
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Stt">
                                                                <HeaderTemplate>
                                                                    STT
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Tên đăng nhập">
                                                                <HeaderTemplate>
                                                                    Tên đăng nhập
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                  
                                                                      <asp:Label ID="lblUser" runat="server" Text='<%# Eval("UserName")%>'></asp:Label>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Họ tên">
                                                                <HeaderTemplate>
                                                                    Họ tên
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Eval("UserDescription")%>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                             <asp:TemplateField HeaderText="Chi nhánh">
                                                                <HeaderTemplate>
                                                                    Chi nhánh
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Eval("sitename")%>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                             <asp:TemplateField>
                                                                 <ItemTemplate>
                                                                    <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" 
                                                                    CommandName="chon" Height="20px" ImageUrl="~/Images/add.png" />
                                                                </ItemTemplate>
                                                                <ControlStyle BackColor="White" BorderColor="White" />
                                                                <FooterStyle BackColor="White" BorderColor="White" />
                                                                <HeaderStyle BackColor="White" BorderColor="White" />
                                                                <ItemStyle BackColor="White" BorderColor="White" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </div>
                    </div>
                </ContentTemplate>
            </cc1:TabPanel>
        </cc1:TabContainer>
    </ContentTemplate>
</asp:UpdatePanel>
<uc1:uscMsgBox ID="uscMsgBox1" runat="server" />
